{template 'common/header'}
    <div id="main-column" class="container-12 clearfix member-center">
        <div class="column2 grid-3 alpha omega">
            {template 'setting/nav'}
        </div>
        <div class="column1 grid-10 alpha omega modules">
            <div class="list">
				{loop $mymodules $row}
            	<div class="module_item clearfix{if !$row['enabled']} disabled{/if}">
                    <div class="module_content clearfix">
                    	<div class="data fl">{$row['title']}<span style="font-size:12px;">（标识：{$row['name']}）</span></div>
                        <div class="fr">
                        {if $row['enabled']}
                        {if !$row['issystem']}
							优先级：
							<select onchange="ajaxopen('{php echo create_url('setting/module/displayorder', array('mid' => $row['mid']))}&displayorder=' + this.options[this.selectedIndex].value)">
                            	<option {if $row['displayorder'] == 0} selected="selected"{/if} value="0">默认级别</option>
								<option {if $row['displayorder'] == 1} selected="selected"{/if}value="1">1</option>
								<option {if $row['displayorder'] == 2} selected="selected"{/if}value="2">2</option>
								<option {if $row['displayorder'] == 3} selected="selected"{/if}value="3">3</option>
								<option {if $row['displayorder'] == 4} selected="selected"{/if}value="4">4</option>
								<option {if $row['displayorder'] == 5} selected="selected"{/if}value="5">5</option>
							</select>
                        {else}
                        系统模块始终优先
                        {/if}
                        {/if}
                        </div>
                    </div>
                    <div class="module_desc clearfix" style="height:auto;line-height:25px;">
						<div class="module_m">
							<div class="fl">
								{$row['ability']}
							</div>
							<div class="fr">
								<a href="###" id="description_button_{$row['mid']}" status="1" onclick="toggle_description(this.id);return false;">介绍</a>
								<!--a href="###">设置</a-->
								<span>
								{if $row['enabled']}
								<a id="enabled_{$row['mid']}_0" href="{php echo create_url('setting/module/enable', array('mid' => $row['mid'], 'enabled' => 0))}" onclick="return ajaxopen(this.href, function(){toggle(0, '{$row['mid']}')});">禁用</a>
								{else}
								<a id="enabled_{$row['mid']}_1" href="{php echo create_url('setting/module/enable', array('mid' => $row['mid'], 'enabled' => 1))}" onclick="return ajaxopen(this.href, function(){toggle(1, '{$row['mid']}')});">启用</a>
								{/if}
								</span>
							</div>
						</div>
						<div class="module_description">
							<span class="fl"><span style="font-weight:bold;">功能介绍：</span>{$row['description']}</span>
						</div>
                        <!--table>
                            <tr>
                                <td width="80">模块标识</td>
                                <td>{$row['name']}</td>
                            </tr>
                            <tr>
                                <td>模块名称</td>
                                <td>{$row['title']}</td>
                            </tr>
                            <tr>
                                <td>功能描述</td>
                                <td>{$row['ability']}</td>
                            </tr>
                            <tr>
                                <td>功能介绍</td>
                                <td>{$row['description']}</td>
                            </tr>
                            {if is_array($row['settings'])}
                            <tr>
                                <td>配置选项</td>
                                <td>
                                    {loop $row['settings'] $name $title}
                                        <a href="{$name}">{$title}</a> <br />
                                    {/loop}
                                </td>
                            </tr>
                            {/if}
                        </table-->
                    </div>
                </div>
				{/loop}
            </div>
			<div>
				{$pager}
			</div>
        </div>
    </div>
    <script type="text/javascript">
        function toggle(status, id) {
            var container = $('#enabled_'+id+'_'+status).parent().parent().parent().parent().parent();
			if(status) {
				container.removeClass('disabled');
				//container.find('.desc').slideDown('normal');
				$('#enabled_'+id+'_'+status).parent().html('<a id="enabled_'+id+'_0" href="setting.php?act=module&do=enable&mid='+id+'&enabled=0" onclick="return ajaxopen(this.href, function(){toggle(0, \''+id+'\')});">禁用</a>');
			} else {
				container.addClass('disabled');
				//container.find('.desc').slideUp('normal');
				$('#enabled_'+id+'_'+status).parent().html('<a id="enabled_'+id+'_1" href="setting.php?act=module&do=enable&mid='+id+'&enabled=1" onclick="return ajaxopen(this.href, function(){toggle(1, \''+id+'\')});">启用</a>');
			}
        }
		function toggle_description(id) {
			var container = $('#'+id).parent().parent().parent();
			var status = $('#'+id).attr("status");
			if(status == 1) {
				$('#'+id).attr("status", "0")
				container.find(".module_description").show();
			} else {
				$('#'+id).attr("status", "1")
				container.find(".module_description").hide();
			}
        }
    </script>
{template 'common/footer'}